Release 10.1A: OpenEdge Development:
ProDataSets
Overview
If you run
PickOrder.wand tab through all the filter fields without entering a value into one, you’ll see a small but noticeable delay before theOrderbrowse displays theOrders. After all, Progress has to read nearly 4000Orderrecords from the database, plus theirCustomersandSalesReps, create a temp-table record for each of them, and buffer-copy the database records to the temp-table. Then it copies the ProDataSet definition and the entire contents of thettOrdertable to the window procedure. Considering the amount of work it’s doing, it’s pretty amazing that it doesn’t take a lot longer than it does. However, if the number of rows were even larger, or if you were running the support procedure across an AppServer connection on a different machine, the delay would be much greater.Generally, you should try to avoid giving your users the opportunity to browse through very large numbers of rows on the client, instead prompting them to filter the data in advance as the example window does. However, in some cases you need to move a potentially large number of rows from server to client, and it is often better to do it in batches so the user can see some of the rows before every database record has been read and copied into the temp-table and across to the client. This section extends the example from Chapter 7, " Advanced Events and Attributes."to show you a way of doing this. At the same time we’ll show you how to limit the number of fields copied into the temp-table. After all, the window is only showing four fields from the
ttOrdertable, so there is really no point in copying every field into the temp-table, and more significantly, passing all those field values across to the client where they will never be seen or used.
![]()
To update the code:
- To get started, copy the
PickOrder.wprocedure toPickOrderBatch.w, and theOrderSupport.ptoOrderSupportBatch.p.- Change the
RUNstatement in the Main Block ofPickOrderBatch.wto startOrderSupportBatch.p.- In the
LEAVEtrigger forcSalesRepinPickOrderBatch.w, change theRUNstatement so that you run a different support procedure if the user doesn’t enter a value into any of the filter fields, as shown:
The new procedure
fetchOrderBatchtakes anOrderNumberto start with, and a list of fields to populate the temp-table with. Since you want to start fresh when the user tabs out of theSalesRep, you just pass0as the starting point in theOrdertable. The four fields in the second parameter are the fields the browse uses; those are the only ones you need values for on the client.The
OUTPUTparameter is the same ProDataSet as before.- Switch over to
OrderSupportBatch.p. First you need a new definition at the top, as shown:
The
cFieldListis the list of fields to include in thettOrdertable, passed over tofetchOrderBatch.- Write the
fetchOrderBatchprocedure. It needs the three parameters you saw in theSalesReptrigger. For example:
The selection that becomes the
where-clausefor theOrderquery needs to start with the firstOrderNumbergreater than the one passed in. For the call in theSalesReptrigger, this is the firstOrderin the database. In later calls, theINPUTparameter will be the highestOrderNumberretrieved so far.The
pcFieldListparameter passed in is saved in the variablecFieldList, which can be seen throughout the procedure. For example:
- You use the
BATCH-SIZEattribute on thettOrderbuffer to tell Progress to fill only a maximum of 20 rows into thettOrdertemp-table at a time, as shown:
- The next four lines are the same as in
fetchOrder, and you can copy them from there:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |